// 文件：ApiResponse.java
package com.gufe.common.core.domain.entity; // 改成你项目的包名，比如 com.gufe.dto


public class ApiResponse<T> {
    private Integer code;
    private String msg;
    private T data;

    // 无参构造（Jackson 需要）
    public ApiResponse() {}

    // 全参构造（可选）
    public ApiResponse(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    // Getter 和 Setter
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    // 判断是否成功
    public boolean isSuccess() {
        return this.code != null && this.code == 200;
    }

    @Override
    public String toString() {
        return "ApiResponse{" +
                "code=" + code +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }
}